home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / amos / amoslist-0295.lzh / AMOSLIST / text0031.txt < prev    next >
Encoding:
Text File  |  1995-03-01  |  2.8 KB  |  67 lines

  1.  
  2. > I tried out this routine last night and with some small modifications it worked.
  3. > The logic was spot on, just some syntax and spelling problems.
  4. > I couldn't get the "pop proc[1]" type statement working nor could I find
  5. > reference to using pop proc in this manner. Please enlighten me if this 
  6. > is possible.  I simply used:
  7. > ; button declared as global
  8. >       button=1      
  9. >       pop proc
  10. >  
  11.  
  12.  
  13. Perhaps that is AMOSPro only. A better style than yours is instead of
  14. making button global, put "End Proc[button]" on the end of the procedure,
  15. and delete all the pop procs. Since the code is all in a big IF ELSE ENDIF
  16. statement, the logic will not change when you do this. End Proc[] definitely
  17. works in all versions of AMOS. You can then call the procedure with:
  18.  
  19. TESTBUTTONPRESS[STICK] : BUTTON=Param
  20.  
  21.  
  22. > I think I had problems with the START_TIME variable name as it clashed with a 
  23. > reserved word so I just used BEGIN_TIME.
  24. > Where Paul used "If START_TIME" I used "If BEGIN_TIME<>0".
  25. > Are these If's testing the same thing? (notwithstanding my change of variable name)
  26.  
  27. Yes. AMOS simply evaluates the BEGIN_TIME<>0 to either -1 (True) or 0 (False)
  28. before considering the if, then the IF command looks at its now numeric
  29. argument, and checks if it is non zero. Therefore to check for a variable
  30. begin non-zero, you use IF <VARIABLE> and to check for a variable being zero,
  31. you can use IF Not <VARIABLE>. I admit that it is better style to use <> 0
  32. for numbers, but my style should be used for boolean variables.
  33.  
  34. > I would also like to test for the joystick being held or pressed to the left or right
  35. > or just tapped as well as the button being tested in this manner. Later I will probably
  36. > want to do the same for up and down!
  37. > Q1. Should I incorporate all of this in the one procedure which checks every feature of
  38. >     the joystick in one test of the joy(1) function or should I write seperate procedures.
  39.  
  40. Using Jleft/Jright etc. is not significantly faster or slower than joy(). As
  41. to the number of procedures, use whatever works best for you. Be aware that
  42. having many very small procedures will be slightly slower.
  43.  
  44. > Max Monahan
  45. > M.Monahan@bom.gov.au
  46. >       
  47.  
  48.  
  49. +-------------------------+------------------------------------+
  50. |                         |    _____                           |
  51. | PAUL HICKMAN            |   /     \   ON A HOT SUMMER NIGHT  |
  52. | (ph@doc.ic.ac.uk)       |  /  O O  \  WOULD YOU  OFFER YOUR  |
  53. | DEPARTMENT OF COMPUTING | |    _    | THROAT  TO  THE  WOLF  |
  54. | IMPERIAL COLLEGE LONDON |  \  / \  /  WITH THE RED  ROSES ?  |
  55. |                         |   \_____/                          |
  56. +-------------------------+------------------------------------+
  57. Machines: Amiga 500  WB1.3 - 1mb Memory - External Disk Drive.
  58.           Amiga 1200 WB3.0 - 6mb Memory - 200Mb Hard Disk.
  59.  
  60.  
  61.